﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MVCPets.Extensions;

namespace MVCPets.Tests.Extensions
{
  [TestClass]
  public class IEnumerableExtensions
  {
    public class Item
    {
      public string data;
    }

    [TestMethod]
    public void Test_Do_Foreach()
    {
      IEnumerable<Item> items = new List<Item>()
        {
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
          new Item()  { data = Guid.NewGuid().ToString() },
        };

      items.ForEach(R => R.data = "");
      foreach (Item s in items)
      {
        Assert.IsTrue(s.data == "");
      }
    }
  }
}
